__svninfo__ = "$Id: base.py 18 2006-08-29 17:45:18Z germanogesser $"

import gtk
import gobject
import pygtk

class Base:

	def __init__(self, parent, parent_widget, nome, widget, pack_widget=None):

		self.widget = widget
		self.parent = parent
		self.pack_widget = pack_widget

		self.widget.show_all()

		if pack_widget:
			self.pack_widget.show_all()
			pw = self.pack_widget
		else:
			pw = self.widget
			
		parent_widget.pack_start(pw, True, True, 0)
		parent.w.append_widget(nome, self)

	def encode(self, msg):
		
		try:
			text = unicode(msg, "ISO8859-1").encode("utf8")
		except:
			text = msg
		
		return text

	def __getattr__(self, attrname):

		#print "buscando %s" % attrname
		try:
			ret = getattr(self.widget, attrname)
		except:
			return

		return ret
